/**
 * 
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.repair.AProcessRecord;
import com.thor.palmmall.spi.maintain.SProcessRecord;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AProcessRecordConverter implements Converter<SProcessRecord, AProcessRecord> {

  public static AProcessRecordConverter getInstance() {
    if (instance == null)
      instance = new AProcessRecordConverter();
    return instance;
  }

  private static AProcessRecordConverter instance;

  private AProcessRecordConverter() {
  }

  @Override
  public AProcessRecord convert(SProcessRecord source) {
    if (source == null) {
      return null;
    }
    AProcessRecord target = new AProcessRecord();
    target.setContent(source.getContent());
    target.setOperator(UCN.newInstance(source.getOperator()));
    target.setOperatorTime(source.getOperatorTime());
    return target;
  }
}
